#ifndef _SEMAPHORE_H
#define _SEMAPHORE_H

#ifdef __cplusplus
extern "C" {
#endif

#include <sys/types.h>

//#define MAX_SEMAPHORE 256

struct sem
{
	uint32 max;			// max number of threads
	uint32 cur;			// current number of threads
};

typedef struct sem sem_t;

int semaphore_init (sem_t * sem, uint32 max);
int semaphore_enter (sem_t * sem);
int semaphore_leave (sem_t * sem);

#ifdef __cplusplus
}
#endif

#endif
